﻿#region Imports
using System.ComponentModel;
using CommonUtilities.Extensions;
#endregion

namespace CommonUtilities.Util
{
    public class NotifyPropertyChanged : INotifyPropertyChanged
    {
        #region Declarations
        // RKD
        ///// <summary>
        ///// Delegate for handling PropertyChanged event
        ///// </summary>
        ///// <param name="sender">RKD</param>
        ///// <param name="e">RKD</param>
        //public delegate void PropertyChangedEventHandler(object sender, PropertyChangedEventArgs e);
        /// <summary>
        /// Represents the method that will handle the System.ComponentModel.INotifyPropertyChanged.PropertyChanged
        ///     event raised when a property is changed on a component
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        #region Methods
        /// <summary>
        /// Raises the event when property value is updated
        /// </summary>
        /// <param name="name">Property name</param>
        protected void RaisePropertyChanged(string name)
        {
            if (!this.PropertyChanged.IsNull())
                this.PropertyChanged(this, new PropertyChangedEventArgs(name));
        }
        #endregion
    }
}
